package com.androidx.p013lv.mine.model;

import android.content.Context;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.http.HttpUtils;
import com.androidx.p013lv.base.http.JsonParams;
import com.androidx.p013lv.base.http.UrlManager;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.mine.bean.ExchangeVipBean;
import com.androidx.p013lv.mine.bean.RecodeBean;

/* renamed from: com.androidx.lv.mine.model.ExchangeCenterModel */
public class ExchangeCenterModel extends ViewModel {
    private MutableLiveData<BaseRes<ExchangeVipBean>> commitData;
    private MutableLiveData<BaseRes<RecodeBean>> recodeData;

    public MutableLiveData<BaseRes<ExchangeVipBean>> dataCommit() {
        if (this.commitData == null) {
            this.commitData = new MutableLiveData<>();
        }
        return this.commitData;
    }

    public MutableLiveData<BaseRes<RecodeBean>> dataRecode() {
        if (this.recodeData == null) {
            this.recodeData = new MutableLiveData<>();
        }
        return this.recodeData;
    }

    public void getRecodeStatus(String str, Context context) {
        HttpUtils.getInsatance().get(UrlManager.getInsatance().exchangeReCode(str), new HttpCallback<BaseRes<RecodeBean>>("exchangeReCode", context) {
            /* class com.androidx.p013lv.mine.model.ExchangeCenterModel.C13461 */

            public void onLvSuccess(BaseRes<RecodeBean> baseRes) {
                ExchangeCenterModel.this.recodeData.setValue(baseRes);
            }
        });
    }

    public void commitRecode(String str, Context context) {
        HttpUtils.getInsatance().post(UrlManager.getInsatance().exchangeVipCode(), JsonParams.build().add("reCode", str).commit(), new HttpCallback<BaseRes<ExchangeVipBean>>("exchangeVipCode", context) {
            /* class com.androidx.p013lv.mine.model.ExchangeCenterModel.C13472 */

            public void onLvSuccess(BaseRes<ExchangeVipBean> baseRes) {
                ExchangeCenterModel.this.commitData.setValue(baseRes);
            }
        });
    }

    public void cancelHttp() {
        HttpUtils.getInsatance().cancelTag("exchangeReCode");
        HttpUtils.getInsatance().cancelTag("exchangeVipCode");
    }
}
